ostbuild: Kill "autodiscover-meta"
authorColin Walters <walters@verbum.org>
Mon, 5 Mar 2012 15:39:49 +0000 (10:39 -0500)
committerColin Walters <walters@verbum.org>
Tue, 13 Mar 2012 14:39:25 +0000 (10:39 -0400)
No longer needed.

Makefile-ostbuild.am
src/ostbuild/pyostbuild/builtin_autodiscover_meta.py [deleted file]
src/ostbuild/pyostbuild/main.py

index 95a31de9a56a6377f179414cb39158ab1bdd935c..6857b617c5af9a6c1fa15fbda42979f8265cb854 100644 (file)
@@ -22,7 +22,6 @@ bin_SCRIPTS += ostbuild
 pyostbuilddir=$(libdir)/ostbuild/pyostbuild
 pyostbuild_PYTHON =                                    \
        src/ostbuild/pyostbuild/buildutil.py            \
-       src/ostbuild/pyostbuild/builtin_autodiscover_meta.py    \
        src/ostbuild/pyostbuild/builtin_build.py        \
        src/ostbuild/pyostbuild/builtin_checkout.py     \
        src/ostbuild/pyostbuild/builtin_chroot_compile_one.py   \
diff --git a/src/ostbuild/pyostbuild/builtin_autodiscover_meta.py b/src/ostbuild/pyostbuild/builtin_autodiscover_meta.py
deleted file mode 100755 (executable)
index 235927b..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/python
-#
-# Copyright (C) 2011 Colin Walters <walters@verbum.org>
-#
-# This library is free software; you can redistribute it and/or
-# modify it under the terms of the GNU Lesser General Public
-# License as published by the Free Software Foundation; either
-# version 2 of the License, or (at your option) any later version.
-#
-# This library is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this library; if not, write to the
-# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-# Boston, MA 02111-1307, USA.
-
-import os,sys,re,subprocess,tempfile,shutil
-import argparse
-import json
-
-from . import builtins
-from . import buildutil
-from .ostbuildlog import log, fatal
-from .subprocess_helpers import run_sync, run_sync_get_output
-
-class OstbuildAutodiscoverMeta(builtins.Builtin):
-    name = "autodiscover-meta"
-    short_description = "Extract metadata from the current source directory"
-
-    def execute(self, argv):
-        parser = argparse.ArgumentParser(self.short_description)
-        parser.add_argument('--meta')
-
-        args = parser.parse_args(argv)
-
-        KEYS = {}
-        AUTODISCOVERED_KEYS = {}
-
-        def _register_discover_func(key, func):
-            if key not in AUTODISCOVERED_KEYS:
-                AUTODISCOVERED_KEYS[key] = []
-            AUTODISCOVERED_KEYS[key].append(func)
-
-        _register_discover_func('name', self._discover_name_from_cwd)
-        _register_discover_func('version', self._discover_version_from_git)
-        _register_discover_func('branch', self._discover_branch_from_git)
-
-        if args.meta:
-            f = open(args.meta)
-            KEYS = json.load(f)
-            f.close()
-            
-        for (key,hooks) in AUTODISCOVERED_KEYS.iteritems():
-            if key in KEYS:
-                continue
-            for func in hooks:
-                    value = func()
-            
-                    if value is None:
-                        continue
-            
-                    KEYS[key] = value
-                    break
-            
-        json.dump(KEYS, sys.stdout, indent=2)
-        
-    def _discover_name_from_cwd(self):
-        return os.path.basename(os.getcwd())
-        
-    def _discover_version_from_git(self):
-        if os.path.isdir('.git'):
-            return buildutil.get_git_version_describe(os.getcwd())
-        return None
-        
-    def _discover_branch_from_git(self):
-        if os.path.isdir('.git'):
-            devnull=open('/dev/null', 'w')
-            ref = run_sync_get_output(['git', 'symbolic-ref', 'HEAD'], stderr=devnull, none_on_error=True)
-            if ref is not None:
-                return ref.replace('refs/heads/', '').strip()
-            ref = run_sync_get_output(['git', 'describe', '--tags', '--exact-match', 'HEAD'], stderr=devnull, none_on_error=True)
-            if ref is not None:
-                return ref
-        return None
-    
-builtins.register(OstbuildAutodiscoverMeta)
index f82d8f6cdbe72e2ed2a591bc0c20eafece441574..a20aafe730b0815616c34bb6ee04f191e323cb9a 100755 (executable)
@@ -22,7 +22,6 @@ import sys
 import argparse
 
 from . import builtins
-from . import builtin_autodiscover_meta
 from . import builtin_build
 from . import builtin_checkout
 from . import builtin_chroot_compile_one